3.681 \(\int (a+b \sin (e+f x))^2 \, dx\)

Optimal. Leaf size=50 \[ \frac{1}{2} x \left (2 a^2+b^2\right )-\frac{2 a b \cos (e+f x)}{f}-\frac{b^2 \sin (e+f x) \cos (e+f x)}{2 f} \]

[Out]

((2*a^2 + b^2)*x)/2 - (2*a*b*Cos[e + f*x])/f - (b^2*Cos[e + f*x]*Sin[e + f*x])/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0161034, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 1, number of rules used = 1, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.083, Rules used = {2644} \[ \frac{1}{2} x \left (2 a^2+b^2\right )-\frac{2 a b \cos (e+f x)}{f}-\frac{b^2 \sin (e+f x) \cos (e+f x)}{2 f} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[e + f*x])^2,x]

[Out]

((2*a^2 + b^2)*x)/2 - (2*a*b*Cos[e + f*x])/f - (b^2*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 2644

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[((2*a^2 + b^2)*x)/2, x] + (-Simp[(2*a*b*Cos[c
+ d*x])/d, x] - Simp[(b^2*Cos[c + d*x]*Sin[c + d*x])/(2*d), x]) /; FreeQ[{a, b, c, d}, x]

Rubi steps

\begin{align*} \int (a+b \sin (e+f x))^2 \, dx &=\frac{1}{2} \left (2 a^2+b^2\right ) x-\frac{2 a b \cos (e+f x)}{f}-\frac{b^2 \cos (e+f x) \sin (e+f x)}{2 f}\\ \end{align*}

Mathematica [A]  time = 0.0970928, size = 46, normalized size = 0.92 \[ -\frac{-2 \left (2 a^2+b^2\right ) (e+f x)+8 a b \cos (e+f x)+b^2 \sin (2 (e+f x))}{4 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sin[e + f*x])^2,x]

[Out]

-(-2*(2*a^2 + b^2)*(e + f*x) + 8*a*b*Cos[e + f*x] + b^2*Sin[2*(e + f*x)])/(4*f)

________________________________________________________________________________________

Maple [A]  time = 0.018, size = 51, normalized size = 1. \begin{align*}{\frac{1}{f} \left ({b}^{2} \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) -2\,ab\cos \left ( fx+e \right ) +{a}^{2} \left ( fx+e \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(f*x+e))^2,x)

[Out]

1/f*(b^2*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-2*a*b*cos(f*x+e)+a^2*(f*x+e))

________________________________________________________________________________________

Maxima [A]  time = 1.01385, size = 62, normalized size = 1.24 \begin{align*} a^{2} x + \frac{{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2}}{4 \, f} - \frac{2 \, a b \cos \left (f x + e\right )}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

a^2*x + 1/4*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2/f - 2*a*b*cos(f*x + e)/f

________________________________________________________________________________________

Fricas [A]  time = 1.53957, size = 109, normalized size = 2.18 \begin{align*} -\frac{b^{2} \cos \left (f x + e\right ) \sin \left (f x + e\right ) -{\left (2 \, a^{2} + b^{2}\right )} f x + 4 \, a b \cos \left (f x + e\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*cos(f*x + e)*sin(f*x + e) - (2*a^2 + b^2)*f*x + 4*a*b*cos(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 0.308759, size = 78, normalized size = 1.56 \begin{align*} \begin{cases} a^{2} x - \frac{2 a b \cos{\left (e + f x \right )}}{f} + \frac{b^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{b^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac{b^{2} \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \left (a + b \sin{\left (e \right )}\right )^{2} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))**2,x)

[Out]

Piecewise((a**2*x - 2*a*b*cos(e + f*x)/f + b**2*x*sin(e + f*x)**2/2 + b**2*x*cos(e + f*x)**2/2 - b**2*sin(e +
f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*(a + b*sin(e))**2, True))

________________________________________________________________________________________

Giac [A]  time = 1.24285, size = 61, normalized size = 1.22 \begin{align*} \frac{1}{2} \,{\left (2 \, a^{2} + b^{2}\right )} x - \frac{2 \, a b \cos \left (f x + e\right )}{f} - \frac{b^{2} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*(2*a^2 + b^2)*x - 2*a*b*cos(f*x + e)/f - 1/4*b^2*sin(2*f*x + 2*e)/f